/*
 * 后台管理面板样式 - Dashboard CSS
 * 适配 Bootstrap 5
 */

/* --- 基础重置与布局 --- */

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    padding-top: 0;
}

/* --- 顶部导航栏 --- */

.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
    z-index: 1000;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

/* --- 侧边栏样式 --- */

.sidebar {
    border-right: 1px solid #dee2e6;
    background-color: #f8f9fa;
    height: 100vh;
    position: fixed;
    top: 56px; /* 匹配 navbar 高度 */
    left: 0;
    width: 15rem;
    padding-top: 1rem;
    padding-bottom: 2rem;
    z-index: 100;
    transition: all 0.3s ease;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    color: #333;
    padding: 0.6rem 1rem;
    margin: 0 0.5rem;
    border-radius: 4px;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.sidebar .nav-link:hover {
    background-color: #e9ecef;
    color: #000;
    text-decoration: none;
}

.sidebar .nav-link.active {
    background-color: #0d6efd;
    color: white;
    font-weight: 500;
}

.sidebar .nav-link i,
.sidebar .nav-link svg {
    margin-right: 8px;
    width: 16px;
    text-align: center;
    opacity: 0.8;
}

/* 图标建议使用 Bootstrap Icons */
.sidebar .nav-link.active i,
.sidebar .nav-link.active svg {
    opacity: 1;
}

/* --- 主内容区域 --- */

main {
    margin-left: 15rem;
    padding: 2rem 1.5rem;
    min-height: 100vh;
    background-color: #fff;
    transition: margin-left 0.3s ease;
}

/* 面包屑或标题分隔线 */
.border-bottom {
    border-bottom: 1px solid #eee !important;
}

/* --- 响应式：小屏幕适配 --- */

@media (max-width: 992px) {
    .sidebar {
        width: 6rem;
        overflow-x: hidden;
        padding-top: 1rem;
        padding-right: 0;
    }

    .sidebar .nav-link span {
        display: none;
    }

    .sidebar .nav-link {
        justify-content: center;
        padding: 0.8rem 0;
        font-size: 1.2rem;
    }

    .sidebar .nav-link i,
    .sidebar .nav-link svg {
        margin-right: 0;
    }

    main {
        margin-left: 6rem;
        padding: 1.5rem 1rem;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid #dee2e6;
        top: 56px;
    }

    main {
        margin-left: 0;
        padding: 1rem;
    }

    .navbar-toggler {
        display: block;
    }
}

/* --- 内容卡片样式 --- */

.card {
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
    border: 1px solid #e9ecef;
    border-radius: 8px;
    transition: all 0.2s;
}

.card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,.1);
    transform: translateY(-2px);
}

.card-title {
    font-weight: 600;
    color: #212529;
}

/* --- 表格增强 --- */

.table {
    font-size: 0.9rem;
}

.table thead th {
    background-color: #f8f9fa;
    border-top: 0;
    font-weight: 600;
    color: #495057;
}

/* --- 按钮增强 --- */

.btn-sm, .btn-group-sm > .btn {
    border-radius: 4px;
}

.btn-outline-primary {
    border-color: #0d6efd;
    color: #0d6efd;
}

.btn-outline-primary:hover {
    background-color: #0d6efd;
    color: white;
}

/* --- 分页样式 --- */

.pagination {
    font-size: 0.9rem;
}

/* --- 表单控件 --- */

.form-control,
.form-select {
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
}

.form-control:focus,
.form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13,110,253,.25);
}

/* --- 标签/徽章 --- */

.badge {
    font-size: 0.8em;
    font-weight: 500;
    padding: 0.5em 0.7em;
}

/* --- 通知/提示 --- */

.alert {
    border-radius: 8px;
    font-size: 0.95rem;
}

/* --- 暗色模式支持（可选）--- */

@media (prefers-color-scheme: dark) {
    .sidebar {
        background-color: #21252b;
        color: #dee2e6;
    }

    .sidebar .nav-link {
        color: #ced4da;
    }

    .sidebar .nav-link:hover {
        background-color: #343a40;
    }

    .sidebar .nav-link.active {
        background-color: #0d6efd;
    }

    main {
        background-color: #1e2125;
        color: #e9ecef;
    }

    body {
        background-color: #1a1d21;
        color: #e9ecef;
    }

    .card {
        background-color: #2c3034;
        border-color: #343a40;
        color: #e9ecef;
    }

    .table {
        color: #e9ecef;
    }

    .table thead th {
        background-color: #343a40;
        color: #dee2e6;
    }

    .form-control,
    .form-select {
        background-color: #343a40;
        border-color: #495057;
        color: #e9ecef;
    }
}